-
Notifications
You must be signed in to change notification settings - Fork 11.9k
feat(@angular-devkit/build-angular): support karma with application builder #28416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ff28211
to
587e845
Compare
9428e8c
to
c6d1570
Compare
6839c5c
to
f71e5c8
Compare
f71e5c8
to
63cf55c
Compare
clydin
reviewed
Sep 25, 2024
packages/angular_devkit/build_angular/src/builders/karma/application_builder.ts
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/builders/karma/application_builder.ts
Outdated
Show resolved
Hide resolved
packages/angular_devkit/build_angular/src/builders/karma/index.ts
Outdated
Show resolved
Hide resolved
clydin
approved these changes
Sep 25, 2024
b2bc0aa
to
9ef7d75
Compare
In some environments, e.g. containers or in some cases macOS, headless Chrome may not work with the sandbox enabled. This exposes an escape hatch to run tests in those environments. Example use: ```sh yarn bazel test \ //packages/angular_devkit/build_angular:build_angular_karma_test \ --test_env=PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \ --test_env=CHROME_NO_SANDBOX=1 ```
These tests appear to be timing out after 300s somewhat often.
9ef7d75
to
1c15b50
Compare
Adds a new "builderMode" setting for Karma that can be used to switch between webpack ("browser") and esbuild ("application"). It supports a third value "detect" that will use the same bundler that's also used for development builds. The detect mode is modelled after the logic used for the dev-server builder. This initial implementation doesn't properly support `--watch` mode or code coverage.
1c15b50
to
40bcfa7
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
action: merge
The PR is ready for merge by the caretaker
area: @angular-devkit/build-angular
detected: feature
PR contains a feature commit
target: minor
This PR is targeted for the next minor release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
ng test
for projects that are using Karma has a hard dependency on the webpack builder. Apps can't use application builder features in any files loaded in the tests, really.Issue Number: N/A
What is the new behavior?
Apps can opt into using the application builder by setting the
builderMode
for the karma builder to either "application" or "detect". The latter only works if they switched the app to the new builder for their development/production builds. Once they do, we will use the new application builder toolchain to build their tests before running them in Karma.Does this PR introduce a breaking change?
Other information
This PR builds on top of #28479. The "meat" is in the last commit.
find-tests-plugin.ts
intofind-tests.ts
to ensure we use the same list of test files. The code is otherwise unmodified.karma/index.ts
intokarma/browser_builder.ts
. The code is mostly unmodified though moving out thekarmaOptions
initialization changes the order of operations a bit.--builder-mode=application
without changing a project, even in projects that have akarma.config
file.transforms.webpackConfiguration
is present. This could be made a hard error in the future.--watch
nor--code-coverage
. They are likely both necessary to be a full replacement for many teams. I'm planning to implement at least code coverage in a quick-ish follow-up PR.